home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F43126_testImprovedIntegration.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-20  |  3.8 KB  |  109 lines

  1. <xsl:stylesheet version="1.0"
  2.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:IntegralFunction="IntegralFunction"
  4. xmlns:IntegralFunction2="IntegralFunction2"
  5. xmlns:IntegralFunction3="IntegralFunction3"
  6. xmlns:IntegralFunction4="IntegralFunction4"
  7.  exclude-result-prefixes="xsl IntegralFunction IntegralFunction2
  8.  IntegralFunction3 IntegralFunction4"
  9. >
  10.  
  11.   <xsl:import href="improvedIntegration.xsl"/>
  12.   
  13.   <!-- To be applied on any source xml.
  14.        Calculates the values for: 
  15.        Integral of x^2 in the interval [0,1] (1/3),
  16.        Integral of x^3 in the interval [0,1] (1/4),
  17.        Integral of 4/(1 + x┬▓)  in the interval [0,1] (Pi),
  18.        Integral of 1/x in the interval [1,2] (ln 2),
  19.        
  20.        with precision 0.0001
  21.     -->
  22.  
  23.   <xsl:output method="html" encoding="UTF-8"/>
  24.  
  25.   <IntegralFunction:IntegralFunction/>
  26.   <IntegralFunction2:IntegralFunction2/>
  27.   <IntegralFunction3:IntegralFunction3/>
  28.   <IntegralFunction4:IntegralFunction4/>
  29.  
  30.   <xsl:template match="/">
  31.  
  32.     <br /> 1
  33.     <br /><font size="5">∫</font> x² =
  34.     <xsl:variable name="vMyFun" select="document('')/*/IntegralFunction:*[1]"/>
  35.     <xsl:call-template name="improvedIntegration">
  36.       <xsl:with-param name="pFun" select="$vMyFun"/>
  37.       <xsl:with-param name="pA" select="0"/>
  38.       <xsl:with-param name="pB" select="1"/>
  39.       <xsl:with-param name="pEpsRough" select="0.001"/>
  40.       <xsl:with-param name="pEpsImproved" select="0.0001"/>
  41.     </xsl:call-template>
  42.     <br />0
  43.  
  44.     <br />
  45.     <br /> 1
  46.     <br /><font size="5">∫</font> x³ =
  47.     <xsl:variable name="vMyFun2" select="document('')/*/IntegralFunction2:*[1]"/>
  48.     <xsl:call-template name="improvedIntegration">
  49.       <xsl:with-param name="pFun" select="$vMyFun2"/>
  50.       <xsl:with-param name="pA" select="0"/>
  51.       <xsl:with-param name="pB" select="1"/>
  52.       <xsl:with-param name="pEpsRough" select="0.001"/>
  53.       <xsl:with-param name="pEpsImproved" select="0.0001"/>
  54.     </xsl:call-template>
  55.     <br />0
  56.  
  57.     <br />
  58.     <br /> 1
  59.     <br /><font size="5">∫</font> 4/(1 + x²) =
  60.     <xsl:variable name="vMyFun3" select="document('')/*/IntegralFunction3:*[1]"/>
  61.     <xsl:call-template name="improvedIntegration">
  62.       <xsl:with-param name="pFun" select="$vMyFun3"/>
  63.       <xsl:with-param name="pA" select="0"/>
  64.       <xsl:with-param name="pB" select="1"/>
  65.       <xsl:with-param name="pEpsRough" select="0.001"/>
  66.       <xsl:with-param name="pEpsImproved" select="0.0001"/>
  67.     </xsl:call-template>
  68.     <br />0
  69.  
  70.     <br />
  71.     <br /> 2
  72.     <br /><font size="5">∫</font> 1/x =
  73.     <xsl:variable name="vMyFun4" select="document('')/*/IntegralFunction4:*[1]"/>
  74.     <xsl:call-template name="improvedIntegration">
  75.       <xsl:with-param name="pFun" select="$vMyFun4"/>
  76.       <xsl:with-param name="pA" select="1"/>
  77.       <xsl:with-param name="pB" select="2"/>
  78.       <xsl:with-param name="pEpsRough" select="0.001"/>
  79.       <xsl:with-param name="pEpsImproved" select="0.01"/>
  80.     </xsl:call-template>
  81.     <br />1
  82.  
  83.   </xsl:template>
  84.  
  85.   <xsl:template name="myIntegralFn" match="*[namespace-uri()='IntegralFunction']">
  86.     <xsl:param name="pX"/>
  87.  
  88.     <xsl:value-of select="$pX * $pX"/>
  89.   </xsl:template>
  90.  
  91.   <xsl:template name="myIntegralFn2" match="*[namespace-uri()='IntegralFunction2']">
  92.     <xsl:param name="pX"/>
  93.  
  94.     <xsl:value-of select="$pX * $pX * $pX"/>
  95.   </xsl:template>
  96.  
  97.   <xsl:template name="myIntegralFn3" match="*[namespace-uri()='IntegralFunction3']">
  98.     <xsl:param name="pX"/>
  99.  
  100.     <xsl:value-of select="4 div (1 + $pX * $pX)"/>
  101.   </xsl:template>
  102.  
  103.   <xsl:template name="myIntegralFn4" match="*[namespace-uri()='IntegralFunction4']">
  104.     <xsl:param name="pX"/>
  105.  
  106.     <xsl:value-of select="1 div $pX"/>
  107.   </xsl:template>
  108.  
  109. </xsl:stylesheet>